package com.leo.foodmaster.admin.system.mapper;

import com.leo.foodmaster.admin.system.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 角色表 Mapper 接口
 * </p>
 *
 * @author Leo
 * @since 2021-06-18
 */
public interface RoleMapper extends BaseMapper<Role> {

    /**
     * 根据角色Id查询角色的公司的状态
     * @param roleId 角色Id
     * @return String
     */
    @Select("SELECT b.`status` " +
            "FROM sys_role AS a " +
            "JOIN sys_organ AS b " +
            "ON a.organ_id = b.id " +
            "WHERE a.id = #{roleId} ")
    String getOrganStatus(Long roleId);
}
